from django import template
from django.core.cache import cache

register = template.Library()

@register.filter(name="user_image")
def profile_image(value):
    user = cache.get("user_%s"%value.id)
    return user and user.get('image')